package com.example.clientbwic.controller;

import com.example.clientbwic.entity.Client;
import com.example.clientbwic.service.login.LoginService;
import com.example.clientbwic.utils.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 86150
 * @Date: 2024/4/13
 * @Description: com.example.clientbwic.controller
 */
@RestController
public class LoginController {
    @Resource
    LoginService loginService;
    @GetMapping("/client/login/{id}")
    public Result<Client> verify(@PathVariable Long id){
        Client client = loginService.getClient(id);
        if (client != null) return Result.success(client);
        return Result.fail("用户不存在");
    }
}
